package com.jx.smartbot.entityListener;

import java.util.Date;

import javax.annotation.Resource;
//import javax.persistence.PostPersist;
import javax.persistence.PrePersist;

import com.jx.smartbot.entity.WpAssistant;
import com.jx.smartbot.entity.WpAssistantAgent;
import com.jx.smartbot.entity.WpAssistantGocom;

public class WpAssistantListener {
	private static org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(WpAssistantListener.class);
	@Resource(name="apiurl")
	String gocomeApiUrl;
	@PrePersist
    public void postPersist(Object entity) {
        if (entity.getClass() == WpAssistant.class) {
        	WpAssistant assistant=(WpAssistant)entity;
        	if(assistant.getCreateTime()==null){
        		assistant.setCreateTime(new Date());
        	}
    		assistant.setUpdateTime(new Date());
        }
        if (entity.getClass() == WpAssistantAgent.class) {
        	WpAssistantAgent assistantAgent=(WpAssistantAgent)entity;
        	if(assistantAgent.getCreateTime()==null){
        		assistantAgent.setCreateTime(new Date());
        	}
        	assistantAgent.setUpdateTime(new Date());
        }
        if (entity.getClass() == WpAssistantGocom.class) {
        	//WpAssistantGocom wpAssistantGocom=(WpAssistantGocom)entity;
        	//wpAssistantGocom.
        }
    }
}
